{% extends "basic/layout.html" %}

{% if theme_bootstrap_version == "3" %}
  {% set bootstrap_version, navbar_version = "3.4.1", "" %}
  {% set bs_span_prefix = "col-md-" %}
{% else %}
  {% set bootstrap_version, navbar_version = "2.3.2", "-2" %}
  {% set bs_span_prefix = "span" %}
{% endif %}

{% set script_files = script_files + [
    '_static/js/jquery-3.5.1.min.js',
    '_static/js/jquery-ui.min.js',
    '_static/bootstrap-' + bootstrap_version + '/js/bootstrap.min.js',
    '_static/js/jquery-fix.js',
    '_static/bootstrap-sphinx.js',
    '_static/navbarscroll.js',
    '_static/dv_rebind_bootstrap_ui.js'
  ]
%}

{%- set render_sidebar = (not embedded) and (not theme_nosidebar|tobool) and sidebars %}

{%- set bs_content_width = render_sidebar and "9" or "12"%}

{%- block doctype -%}
<!DOCTYPE html>
{%- endblock %}

{%- block linktags %}
<link type="text/css" rel="stylesheet" href="{{pathto("_static/fontcustom.css", 1)}}" />
<link type="text/css" rel="stylesheet" href="{{pathto("_static/socicon.css", 1)}}" />
<link type="text/css" rel="stylesheet" href="{{pathto("_static/theme.css", 1)}}" />
<link type="text/css" rel="stylesheet" href="{{pathto("_static/primefaces.css", 1)}}" />
<link type="text/css" rel="stylesheet" href="{{pathto("_static/docsdataverse_org.css", 1)}}" />
{%- endblock %}

{%- block extrahead %}
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">
<meta name="apple-mobile-web-app-capable" content="yes">
<link type="image/png" rel="icon" href="{{pathto("_static/images/favicondataverse.png", 1)}}" />
{% endblock %}

{# Sidebar: Rework into our Bootstrap nav section. #}
{% macro navBar() %}
{% include "navbar" + navbar_version + ".html" %}
{% endmacro %}

{% if theme_bootstrap_version == "3" %}
  {%- macro bsidebar() %}
      {%- if render_sidebar %}
      <div class="{{ bs_span_prefix }}3">
        <div id="sidebar" class="bs-sidenav" role="complementary">
          {%- for sidebartemplate in sidebars %}
            {%- include sidebartemplate %}
          {%- endfor %}
        </div>
      </div>
      {%- endif %}
  {%- endmacro %}
{% else %}
  {%- macro bsidebar() %}
      {%- if render_sidebar %}
      <div class="{{ bs_span_prefix }}3">
        <div id="sidebar" class="bs-sidenav well" data-spy="affix">
          {%- for sidebartemplate in sidebars %}
            {%- include sidebartemplate %}
          {%- endfor %}
        </div>
      </div>
      {%- endif %}
  {%- endmacro %}
{% endif %}

{# Silence the sidebar's, relbar's #}
{% block header %}{% endblock %}
{% block relbar1 %}{% endblock %}
{% block relbar2 %}{% endblock %}
{% block sidebarsourcelink %}{% endblock %}

{%- block content %}
{{ navBar() }}
<div class="container">
  <div class="row">
    {%- block sidebar1 %}{{ bsidebar() }}{% endblock %}
    <div class="{{ bs_span_prefix }}{{ bs_content_width }} content" role="main">
      {% block body %}{% endblock %}
      <!-- Previous button -->
      {%- if prev %}
        <a href="{{ prev.link|e }}" title="{{ _('Previous Chapter: ') + prev.title|striptags }}">
          {%- if theme_bootstrap_version == "2" -%}<span class="icon-chevron-left visible-tablet"></span>{%- endif -%}
          {%- if theme_bootstrap_version == "3" -%}<span class="glyphicon glyphicon-chevron-left visible-sm"></span>{%- endif -%}
          <span class="hidden-sm hidden-tablet">{{ "&laquo;Previous"|safe }}</span>
        </a>
      {%- endif %}
      <!-- Next button -->
      {%- if next %}
        <a href="{{ next.link|e }}" title="{{ _('Next Chapter: ') + next.title|striptags }}" style="float: right;">
          {%- if theme_bootstrap_version == "2" -%}<span class="icon-chevron-right visible-tablet"></span>{%- endif -%}
          {%- if theme_bootstrap_version == "3" -%}<span class="glyphicon glyphicon-chevron-right visible-sm"></span>{%- endif -%}
          <span class="hidden-sm hidden-tablet">{{ "Next&raquo"|safe }}</span>
        </a>
      {%- endif %}
    </div>
    {% block sidebar2 %} {# possible location for sidebar #} {% endblock %}
  </div>
</div>
{%- endblock %}

{%- block footer %}
<footer class="footer">
  <div class="container">
    <p class="pull-right">
      <a href="#">Back to top</a>
      {% if theme_source_link_position == "footer" %}
        <br/>
        {% include "sourcelink.html" %}
      {% endif %}
    </p>
    {%- if show_copyright %}
      {%- if hasdoc('copyright') %}
        {% trans path=pathto('copyright'), copyright=copyright|e %}<p><a href="{{ path }}">Copyright</a>  &#169; {{ copyright }}.</p>{% endtrans %}
      {%- else %}
      {% trans copyright=copyright|e %}<p>Developed at the <a href="http://www.iq.harvard.edu/" title="Institute for Quantitative Social Science" target="_blank">Institute for Quantitative Social Science</a>  &nbsp;|&nbsp;  Code available at <a href="https://github.com/IQSS/dataverse" title="Dataverse on GitHub" target="_blank"><span class="socicon socicon-github"></span></a> &nbsp;|&nbsp; Created using <a href="https://www.sphinx-doc.org" title="Sphinx" target="_blank">Sphinx</a> {{ sphinx_version }}<br/>Last updated on {{ last_updated }} &nbsp;|&nbsp; Dataverse v. {{ version }} &nbsp;|&nbsp; View the <a href="http://guides.dataverse.org/en/latest/" title="Dataverse Guides">latest version of Dataverse Guides</a></p>
        <p>Copyright &#169; {{ copyright }}</p> {% endtrans %}
      {%- endif %}
    {%- endif %}
  </div>
</footer>
{%- endblock %}
